﻿using System;
using System.Windows.Forms;
using ebc.viz.contracts;

namespace ebc.viz.app
{
    internal class Validate_commandline_params : IValidate_commandline_params
    {
        public void Process(string[] args)
        {
            if (args.Length == 0) throw new InvalidOperationException("Missing names of files to visualize! Pass them in on the command line.");

            if (args[0].EndsWith(".ebc.xml"))
                this.VisualizeBoard(args);
            else if (args[0].EndsWith(".csproj"))
                this.VisualizeProject(args);
            else
                new InvalidOperationException("Invalid file type detected! Files that can be analysed have the extension .ebc.xml or .csproj.");
        }

        public event Action<string[]> VisualizeProject;
        public event Action<string[]> VisualizeBoard;
    }
}